using System;
using Avalonia.Controls;
using Avalonia.Interactivity;
using IntegratedMeasuring.ViewModels.Scheme;
using System.Collections.Generic;
using Avalonia.Collections;

namespace IntegratedMeasuring.Pages;

public partial class TestConditionDetailDialog : Window
{
    public TestConditionDetailDialog(TestConditions testConditions)
    {
        InitializeComponent();
        FileNameText.Text = testConditions.Name ?? "(无名称)";
        RemarksText.Text = testConditions.Remarks ?? "(无备注)";
        CreateTimeText.Text = testConditions.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
        
        // 分组并绑定DataGrid
        var beautifyData = testConditions?.BeautifyData ?? new List<TransItemData>();
        var view = new DataGridCollectionView(beautifyData);
        DataGrid.ItemsSource = view;
    }

    private void CloseButton_Click(object? sender, RoutedEventArgs e)
    {
        this.Close();
    }
}

